﻿using System.Collections.Generic;
using System.Linq;
using WD.Core.Cache;
using WD.Db.Contract;
using WD.Db.Contract.Model;

namespace WD.Web.MVC.Common
{
    public class CommonCache
    {

        /// <summary>
        /// Base_CodeData缓存
        /// </summary>
        public static Dictionary<int, Base_CodeData> CodeDataByCache
        {
            get
            {
                return CacheHelper.Get("CodeDataByCache",
                    () => ServiceContext.Current.Base_CodeDataService.GetBase_CodeDataList(new BaseRequest { GetAll = true }).ToDictionary(a => a.ID));
            }
            set
            {
                if (value == null) { CacheHelper.Remove("CodeDataByCache"); }
            }
        }

     
    }
}
